/*
 * QTeXPreview
 * Copyright (C) 2008, Philip Pronin (philip.pronin@gmail.com)
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#include "window.h"
#include "settings.h"

#include <QtGui>
#include <QApplication>

#ifdef Q_WS_WIN
#include <QtPlugin>
Q_IMPORT_PLUGIN(qjpeg)
Q_IMPORT_PLUGIN(qgif)
#endif // Q_WS_WIN

int main(int argc, char *argv[]) {
	QT_REQUIRE_VERSION(argc, argv, "4.2.0")

	QApplication app(argc, argv);

	QString locale;
	{
		QSettings settings(Settings::fileName, QSettings::IniFormat);
		locale = settings.value("app/locale").toString();
	}
	if (locale.isEmpty()) locale = QLocale::system().name();

	QTranslator translator;
	translator.load(QString("lang/qTeXPre_") + locale);
	QApplication::installTranslator(&translator);

	MainWindow mainWindow;
	mainWindow.show();

	return app.exec();
}
